package com.yanqu.road.server.manger.maidian.manor;

import com.yanqu.data.analytics.constant.EventDataConstants;
import com.yanqu.data.analytics.helper.DataBuilder;
import com.yanqu.road.entity.config.fishpond.FishPondBadgeConfig;
import com.yanqu.road.entity.config.fishpond.FishPondItemConfig;
import com.yanqu.road.entity.config.manor.ManorTechnologyConfig;
import com.yanqu.road.entity.config.patrons.PatronsInfo;
import com.yanqu.road.entity.config.skill.SkillInfo;
import com.yanqu.road.entity.enums.eFishingEventType;
import com.yanqu.road.entity.enums.eSkillType;
import com.yanqu.road.entity.manor.*;
import com.yanqu.road.entity.player.UserPatrons;
import com.yanqu.road.entity.player.UserSkin;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.manor.ManorModule;
import com.yanqu.road.server.gameplayer.module.patrons.PatronsModule;
import com.yanqu.road.server.gameplayer.module.skin.SkinModule;
import com.yanqu.road.server.manger.DataAnalyticsMgr;
import com.yanqu.road.server.manger.config.PatronsMgr;
import com.yanqu.road.server.manger.config.SkillMgr;
import com.yanqu.road.server.manger.maidian.DefaultEventTraceAction;
import com.yanqu.road.server.manger.manor.FishPondMgr;
import com.yanqu.road.server.manger.manor.ManorMgr;
import com.yanqu.road.utils.string.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 庄园埋点
 */
public class ManorFishLog {

    private static Logger logger = LogManager.getLogger(ManorFishLog.class.getName());

    //钓鱼  缓存
    public static Map<Long, List<Map<String, Object>>> fishPondMap = new ConcurrentHashMap<>();

    public static final String FISH_POND = "fish_pond";
    public static final String FISH_HANDBOOK = "fish_handbook";//鱼塘图鉴
    public static final String FISH_BADGE = "fish_badge"; //鱼塘徽章
    public static final String FISH_INFO = "fish_info";//鱼养成信息

    public static final String FISHING = "fishing";  //条鱼

    public static final String FISH_ID = "fish_id"; //鱼名称
    public static final String QUALITY = "quality"; //品质
    public static final String WEATHER = "weather"; //天气
    public static final String DAY_AND_NIGHT = "day_and_night";  //日夜
    public static final String ITEM_NUM = "item_num";  //道具数量
    public static final String UNLOCK = "Unlock"; //是否解锁

    public static final String LEVEL_LIMIT = "level_limit";
    public static final String LEVEL = "level";
    public static final String INTEGRAL = "integral";
    public static final String THRESHOLD = "threshold"; //当前升级门槛

    public static final String HANDBOOK = "handbook";
    public static final String FISH_LIST = "fish_list";


    public static final String FISH_GET = "fish_get";
    public static final String FISH_GETTYPE = "fish_gettype";
    public static final String FISH_GETCONTENT = "fish_getcontent";
    public static final String FISH_QUELITY = "fish_quelity";

    /**
     * 钓鱼
     */
    public static void trackFishPond(GamePlayer player, FishPondItemConfig fishPondItemConfig) {

        try {
            if (!DataAnalyticsMgr.openDataAnalytics()) return;

            List<Map<String, Object>> list = DataAnalyticsMgr.getUserMapDataForNew(player.getUserId(), fishPondMap);

            synchronized (list){
                try {
                    Map<String, Object> map = new HashMap<>();
                    map.put(FISH_ID, fishPondItemConfig.getId());
                    map.put(QUALITY, fishPondItemConfig.getQuality());
                    map.put(WEATHER, fishPondItemConfig.getWeather());
                    map.put(DAY_AND_NIGHT, fishPondItemConfig.getTime());
                    map.put(ITEM_NUM, 1);
                    list.add(map);
                }catch (Exception e){
                    DataAnalyticsMgr.getLogger().error("商品模块 购买道具 fishId:" + fishPondItemConfig.getId(), e);
                }

                if(list.size() + 1 >= EventDataConstants.ARRAY_OBJECT_MAX_SIZE){
                    trackFishPond(player, list);
                }
            }

        }catch (Exception e){
            DataAnalyticsMgr.getLogger().error("analytics trackResourceChange error ", e);
        }
    }

    //登出上报钓鱼数据
    public static void logoutUploadFishPond(GamePlayer player){

        List<Map<String, Object>> list = DataAnalyticsMgr.popUserMapData(player.getUserId(), fishPondMap);

        if(list == null || list.size() == 0){
            return;
        }

        trackFishPond(player, list);

    }

    /**
     * 钓鱼
     */
    public static void trackFishPond(GamePlayer player, List<Map<String, Object>> list) {

        try{
//            DefaultEventTraceAction traceAction = new DefaultEventTraceAction(FISH_POND, player);
//            traceAction.build(FISHING, list).trace();
        }catch (Exception e){
            logger.error(" trackFishPond ", e);
        }

    }

    /**
     * 徽章
     */
    public static void trackFishBadeg(GamePlayer player) {

        try{
            DefaultEventTraceAction traceAction = new DefaultEventTraceAction(FISH_BADGE, player);
            FishPondData fishPondData = player.getModule(ManorModule.class).getManorFishPondModel().getFishPondData();
            if(fishPondData == null){
                return;
            }
            //最高等级
            traceAction.build(LEVEL_LIMIT, FishPondMgr.getFishPondBadgeConfigMap().size());
            traceAction.build(LEVEL, fishPondData.getFishPondLv());
            traceAction.build(INTEGRAL, fishPondData.getFishPondScore());
            FishPondBadgeConfig config = FishPondMgr.getFishPondBadgeConfigMap().get(fishPondData.getFishPondLv());
            if(config != null){
                traceAction.build(THRESHOLD, config.getNeedFisherPoints());
            }

            traceAction.trace();
        }catch (Exception e){
            logger.error(" trackFishBadeg ", e);
        }

    }

    /**
     * 鱼塘图鉴
     */
    public static void trackFishHandbook(GamePlayer player) {

        try{
            DefaultEventTraceAction traceAction = new DefaultEventTraceAction(FISH_HANDBOOK, player);


            Map<Integer, FishData> fishDataMap = player.getModule(ManorModule.class).getManorFishPondModel().getFishDataMap();
            List<Map<String, Object>> list = new ArrayList<>();
            for (Map.Entry<Integer, FishPondItemConfig> configEntry : FishPondMgr.getFishPondItemConfigMap().entrySet()) {
                FishPondItemConfig itemConfig = configEntry.getValue();
                if(itemConfig.getType() == 1){
                    Map<String, Object> map = new HashMap<>();
                    map.put(FISH_ID, itemConfig.getId());
                    map.put(QUALITY, itemConfig.getQuality());
                    map.put(WEATHER, itemConfig.getWeather());
                    map.put(DAY_AND_NIGHT, itemConfig.getTime());
                    map.put(UNLOCK, fishDataMap.containsKey(itemConfig.getId()));
                }
            }
            traceAction.build(HANDBOOK, list);
            traceAction.trace();
        }catch (Exception e){
            logger.error(" trackFishHandbook ", e);
        }

    }


    public static final String INTELLIGENCE = "intelligence";               //资质
    public static final String AWAKEN_LEVEL = "awaken_level";               //觉醒等级
    public static final String WHETHER_EQUIPPED = "Whether_equipped";       //是否装备
    public static final String GUEST_NAME = "guest_name";
    public static final String VOCATION = "vocation";                       //门客职业
    public static final String CURRENT_MINISTER_POWER = "Current_minister_Power";       //当前赚钱
    public static final String CURRENT_INTELLIGENCE = "Current_intelligence";           //当前资质
    public static final String EQUIPMENT_PERCENT_POWER_LIMIT = "equipment_percent_power_limit";         //装备理论百分比赚钱
    public static final String UPGRADED_EQUIPMENT_PERCENT_POWER = "Upgraded_equipment_percent_power";   //装备百分比赚钱
    public static final String EQUIPMENT_FIXPOWER_LIMIT = "equipment_Fixpower_limit";                   //装备理论固定赚钱
    public static final String UPGRADED_EQUIPMENT_FIXPOWER = "Upgraded_equipment_Fixpower";             //装备固定赚钱
    public static final String INTELLIGENCE_LIMIT = "Intelligence_limit";                               //资质丹技能理论资质
    public static final String UNLOCKED_INTELLIGENCE = "Unlocked_intelligence";                         //资质技能当前资质
    public static final String UPGRADED_INTELLIGENCE = "Upgraded_intelligence";                         //当前资质丹资质



    /**
     * 鱼养成信息
     */
    public static void trackFishInfo(GamePlayer player) {

        try{
            DefaultEventTraceAction traceAction = new DefaultEventTraceAction(FISH_INFO, player);
            List<Map<String, Object>> list = new ArrayList<>();

            PatronsModule patronsModule = player.getModule(PatronsModule.class);
            ManorModule manorModule = player.getModule(ManorModule.class);
            Map<Integer, FishData> fishDataMap = manorModule.getManorFishPondModel().getFishDataMap();
            for (Map.Entry<Integer, FishData> dataEntry : fishDataMap.entrySet()) {

                if(list.size() >= 500){
                    traceAction.build(FISH_LIST, list).trace();
                    list = new ArrayList<>();
                    traceAction = new DefaultEventTraceAction(FISH_INFO, player);
                }

                Map<String, Object> map = new HashMap<>();
                FishData fishData = dataEntry.getValue();
                FishPondItemConfig config = FishPondMgr.getFishPondItemConfig(fishData.getFishId());
                map.put(FISH_ID, fishData.getFishId());
                map.put(QUALITY, config.getQuality());       //品质
                //map.put(INTELLIGENCE, config.getQuality());  //资质 todo
                map.put(AWAKEN_LEVEL, fishData.getLv());
                map.put(WHETHER_EQUIPPED, fishData.getEquipPatronsId() > 0 ? 1 : 0);
                if(fishData.getEquipPatronsId() > 0){
                    PatronsInfo patronsInfo = PatronsMgr.getPatronsInfo(fishData.getEquipPatronsId());
                    UserPatrons userPatrons = patronsModule.getUserPatrons(patronsInfo.getId());
                    map.put(VOCATION, patronsInfo.getOccupation());
                    map.put(GUEST_NAME, patronsInfo.getId());
                    map.put(CURRENT_MINISTER_POWER, userPatrons.getAbility().toString());
                    map.put(CURRENT_INTELLIGENCE, userPatrons.getTotalQualification());

                    for (Map.Entry<Integer, FishSkillData> skillDataEntry : fishData.getFishSkillDataMap().entrySet()) {
                        SkillInfo skillInfo = SkillMgr.getSkillInfo(skillDataEntry.getValue().getFishSkillId());
                        if(skillInfo != null){
                            if(skillInfo.getType()  == eSkillType.BeautyPatronsSkill2.getValue()) {
                                int maxLv = SkillMgr.getSkillMaxLvByUpgradeType(skillInfo.getUpgradeType(0));
                                int addition = SkillMgr.getSkillAddition(skillInfo, maxLv);
                                map.put(EQUIPMENT_PERCENT_POWER_LIMIT, addition);  //装备理论百分比赚钱
                                map.put(UPGRADED_EQUIPMENT_PERCENT_POWER, FishPondMgr.getFishAddPercentage(fishData.getEquipPatronsId(), fishDataMap)); //装备百分比赚钱

                            }
                            if(skillInfo.getType()  == eSkillType.BeautyPatronsSkill1.getValue()) {
                                int maxLv = SkillMgr.getSkillMaxLvByUpgradeType(skillInfo.getUpgradeType(0));
                                int addition = SkillMgr.getSkillAddition(skillInfo, maxLv);
                                map.put(EQUIPMENT_FIXPOWER_LIMIT, addition);       //装备理论固定赚钱
                                map.put(UPGRADED_EQUIPMENT_FIXPOWER, FishPondMgr.getFishAbilityAddValue(fishData.getEquipPatronsId(), fishDataMap));    //装备固定赚钱
                            }
                        }
                    }

                    FishPondItemConfig itemConfig = FishPondMgr.getFishPondItemConfig(fishData.getFishId());
                    if(itemConfig != null && !"0".equals(itemConfig.getSkills())) {
                        //所有配置的技能
                        List<Integer>  allSkillList = new ArrayList<>();
                        List<String> stringList = StringUtils.stringToStringList(itemConfig.getSkills(), "\\|");
                        for (String s : stringList) {
                            List<Integer> vList = StringUtils.stringToIntegerList(s, ";");
                            allSkillList.add(vList.get(0));
                        }
                        int addition = 0;
                        for (int skillId : allSkillList) {
                            SkillInfo skillInfo = SkillMgr.getSkillInfo(skillId);
                            if(skillInfo != null && skillInfo.getType() == eSkillType.Qualification.getValue()) {
                                int maxLv = SkillMgr.getSkillMaxLvByUpgradeType(skillInfo.getUpgradeType(0));
                                addition += SkillMgr.getSkillAddition(skillInfo, maxLv);
                            }
                        }
                        map.put(INTELLIGENCE_LIMIT, addition);             //资质丹技能理论资质

                        //已解锁的资质技能
                        int maxAddition = 0;
                        int nowAddition = 0;
                        for (Map.Entry<Integer, FishSkillData> skillDataEntry : fishData.getFishSkillDataMap().entrySet()) {
                            FishSkillData skillData = skillDataEntry.getValue();
                            SkillInfo skillInfo = SkillMgr.getSkillInfo(skillData.getFishSkillId());
                            if(skillInfo != null && skillInfo.getType() == eSkillType.Qualification.getValue()) {
                                int maxLv = SkillMgr.getSkillMaxLvByUpgradeType(skillInfo.getUpgradeType(0));
                                maxAddition += SkillMgr.getSkillAddition(skillInfo, maxLv);
                                nowAddition += SkillMgr.getSkillAddition(skillInfo, skillData.getLv());
                            }
                        }
                        map.put(UNLOCKED_INTELLIGENCE, maxAddition);          //资质技能当前资质
                        map.put(UPGRADED_INTELLIGENCE, nowAddition);          //当前资质丹资质
                    }
                }

                list.add(map);
            }

            if(list.size() > 0) {
                traceAction.build(FISH_LIST, list).trace();
            }

        }catch (Exception e){
            logger.error(" trackFishInfo ", e);
        }

    }

    /**
     * 新钓鱼埋点
     */
    public static void trackNewFishPond(GamePlayer player, List<FishingResult> fishingResultList) {
        try{

            if(!DataAnalyticsMgr.openDataAnalytics()){
                return;
            }

            DefaultEventTraceAction action = new DefaultEventTraceAction(FISH_GET, player);
            action.build(FISH_GETTYPE, fishingResultList.size());
            List<Map<String, Object>> group = new ArrayList<>();
            for (FishingResult fishingResult : fishingResultList) {
                if (fishingResult.getEventType() == eFishingEventType.Fish.getValue()) {
                    Map<String, Object> map = new HashMap<>();
                    map.put(FISH_ID, fishingResult.getId());
                    FishPondItemConfig itemConfig = FishPondMgr.getFishPondItemConfig(fishingResult.getId());
                    map.put(FISH_QUELITY, itemConfig.getQuality());
                    group.add(map);
                }
            }
            action.build(FISH_GETCONTENT, group);
            action.trace();
        }catch (Exception e){
            logger.error("error ", e);
        }
    }

    //=============================================================================================================

    public static final String FISH = "fish";

    public static final String FISH_NAME = "fish_name";
    public static final String FISH_LV = "fish_lv";
//    public static final String FISH_QUELITY = "fish_quelity";
    public static final String FISH_NUMBER = "fish_number";
    public static final String FISH_STEP = "fish_step";
    public static final String FISH_SKILL = "fish_skill";
    public static final String FISH_ACHIEVE = "fish_achieve";
    public static final String FISH_LEVEL = "fish_level";
    public static final String FISH_SKILLNAME = "fish_skillname";
    public static final String FISH_SKILLLV = "fish_skilllv";
    public static final String FISH_ACCLV = "fish_acclv";
    public static final String FISH_ISALL = "fish_isall";


    /**
     * 鱼快照
     */
    public static void trackInfoSnapshot(GamePlayer player) {
        try {
            if (!DataAnalyticsMgr.openDataAnalytics()) return;

            //公共事件属性
            DataBuilder common = DataBuilder.newBuilder(player.getUserId(), DataAnalyticsMgr.getDistinctId(player.getUserInfo()));
            DataAnalyticsMgr.buildPublicEventData(player, common);

            ManorModule manorModule = player.getModule(ManorModule.class);
            for (Map.Entry<Integer, FishData> dataEntry : manorModule.getFishDataMap().entrySet()) {
                FishData fishData = dataEntry.getValue();
                //鱼饵不上传
                if(fishData.getLv() <= 0){
                    continue;
                }
                DataBuilder dataBuilder = DataBuilder.newBuilder(player.getUserInfo().getUserId(), DataAnalyticsMgr.getDistinctId(player.getUserInfo()));
                dataBuilder.build(FISH_ID, fishData.getFishId());
                dataBuilder.build(FISH_LV, fishData.getLv());
                FishPondItemConfig fishConfig = FishPondMgr.getFishPondItemConfig(fishData.getFishId());
                if(fishConfig != null){
                    dataBuilder.build(FISH_QUELITY, fishConfig.getQuality());
                }

                int qualification = 0;
                List<Map<String, Object>> objectGroup = new ArrayList<>();
                for (Map.Entry<Integer, FishSkillData> entry : fishData.getFishSkillDataMap().entrySet()) {
                    FishSkillData skillData = entry.getValue();
                    Map<String, Object> map = new HashMap<>();
                    map.put(FISH_SKILLNAME, skillData.getFishSkillId());
                    map.put(FISH_SKILLLV, skillData.getLv());
                    objectGroup.add(map);

                    SkillInfo skillInfo = SkillMgr.getSkillInfo(skillData.getFishSkillId());
                    if (skillInfo != null && skillInfo.getType() == eSkillType.Qualification.getValue()) {
                        qualification += SkillMgr.getSkillAddition(skillInfo, skillData.getLv());
                    }
                }
                dataBuilder.build(FISH_SKILL, objectGroup);

                //资质
                dataBuilder.build(FISH_NUMBER, qualification);
                dataBuilder.getDataMap().putAll(common.getDataMap());
                DataAnalyticsMgr.provider.track(dataBuilder.getAccountId(), dataBuilder.getDistinctId(), FISH, dataBuilder.getDataMap());
            }



        } catch (Exception e) {
            DataAnalyticsMgr.getLogger().error(" error ", e);
        }

    }

    public static final String MANOR = "manor";
    public static final String MANOR_SKILL = "manor_skill";
    public static final String MANOR_FARM = "manor_farm";
    public static final String MANOR_GRASS = "manor_grass";
    public static final String MANOR_BUILD = "manor_build";
    public static final String MANOR_NAME = "manor_name";
    public static final String MANOR_SKILLNAME = "manor_skillname";
    public static final String MANOR_SKILLLV = "manor_skilllv";
    public static final String MANOR_SKILLADD = "manor_skilladd";

    public static final String MANOR_FARMNAME = "manor_farmname";
    public static final String MANOR_FARMNUM = "manor_farmnum";
    public static final String MANOR_FARMLANDLV = "manor_farmlandlv";
    public static final String MANOR_FARMLV = "manor_farmlv";
    public static final String MANOR_FARMSUM = "manor_farmsum";

    public static final String MANOR_GRASSNAME = "manor_grassname";
    public static final String MANOR_GRASSNUM = "manor_grassnum";
    public static final String MANOR_GRASSSUM = "manor_grasssum";
    public static final String MANOR_GRASSBLOODLV = "manor_grassbloodlv";
    public static final String MANOR_GRASSLV = "manor_grasslv";

    public static final String MANOR_BUILDNAME = "manor_buildname";
    public static final String MANOR_BUILDLV = "manor_buildlv";


    /**
     * 庄园快照
     */
    public static void uploadSnapshot(GamePlayer player) {

        try {
            if (!DataAnalyticsMgr.openDataAnalytics()) return;

            DefaultEventTraceAction action = new DefaultEventTraceAction(MANOR, player);
            List<Map<String, Object>> objectGroup = new ArrayList<>();
            ManorModule manorModule = player.getModule(ManorModule.class);
            for (Map.Entry<Integer, ManorTechnologyData> dataEntry : manorModule.getTechnologyDataMap().entrySet()) {
                ManorTechnologyData manorTechnologyData = dataEntry.getValue();
                ManorTechnologyConfig manorTechnologyConfig = ManorMgr.getManorTechnologyConfigMap().get(manorTechnologyData.getId());
                if(manorTechnologyConfig == null){
                    continue;
                }
                for (int i = 0; i < manorTechnologyData.getSkillLvList().size(); i++) {
                    SkillInfo skillInfo = SkillMgr.getSkillInfo(manorTechnologyConfig.getVolumesIdList().get(i));
                    if(skillInfo == null){
                        continue;
                    }
                    int lv = manorTechnologyData.getSkillLvList().get(i);
                    Map<String, Object> map = new HashMap<>();
                    map.put(MANOR_NAME, manorTechnologyData.getId());
                    map.put(MANOR_SKILLNAME, skillInfo.getId());
                    map.put(MANOR_SKILLLV, lv);
                    //算加成
                    int addValue = SkillMgr.getSkillAddition(skillInfo, lv);
                    map.put(MANOR_SKILLADD, addValue);
                    objectGroup.add(map);
                }
            }
            action.build(MANOR_SKILL, objectGroup);

            //农场
            objectGroup = new ArrayList<>();

            if(manorModule.getHarvestModel() == null){
                return;
            }

            //牧场
            List<Map<String, Object>> objectGroup2 = new ArrayList<>();
            for (Map.Entry<Integer, ManorHarvestData> dataEntry : manorModule.getHarvestModel().getHarvestDataMap().entrySet()) {
                ManorHarvestData harvestData = dataEntry.getValue();

                if (harvestData.getHarvestType() <= 100){
                    Map<String, Object> map = new HashMap<>();
                    map.put(MANOR_FARMNAME, harvestData.getOutPutId());
                    map.put(MANOR_FARMLANDLV, harvestData.getSpecialSkillLv());
                    map.put(MANOR_FARMLV, harvestData.getLv());
                    BigDecimal speed = new BigDecimal(harvestData.getBaseSpeed()).multiply(new BigDecimal(1000).add(new BigDecimal(harvestData.getSpecialSkillAddRatio())))
                            .multiply(new BigDecimal(1000).add(new BigDecimal(harvestData.getOtherAddRatio()))).divide((BigDecimal.valueOf(1000 * 1000)), 0, BigDecimal.ROUND_UP);
                    map.put(MANOR_FARMSUM, speed.longValue());
                    objectGroup.add(map);
                }else if (harvestData.getHarvestType() <= 200){
                    //牧场
                    Map<String, Object> map = new HashMap<>();
                    map.put(MANOR_GRASSNAME, harvestData.getOutPutId());
                    map.put(MANOR_GRASSBLOODLV, harvestData.getSpecialSkillLv());
                    map.put(MANOR_GRASSLV, harvestData.getLv());
                    BigDecimal speed = new BigDecimal(harvestData.getBaseSpeed()).multiply(new BigDecimal(1000).add(new BigDecimal(harvestData.getSpecialSkillAddRatio())))
                            .multiply(new BigDecimal(1000).add(new BigDecimal(harvestData.getOtherAddRatio()))).divide((BigDecimal.valueOf(1000 * 1000)), 0, BigDecimal.ROUND_UP);
                    map.put(MANOR_GRASSSUM, speed.longValue());
                    objectGroup2.add(map);
                }
            }
            action.build(MANOR_FARM, objectGroup);
            action.build(MANOR_GRASS, objectGroup2);


            //建筑
            objectGroup = new ArrayList<>();
            SkinModule skinModule = player.getModule(SkinModule.class);
            for (Map.Entry<Integer, ManorBuildingData> buildingDataEntry : manorModule.getBuildingModel().getBuildingDataMap().entrySet()) {
                ManorBuildingData buildingData = buildingDataEntry.getValue();
                Map<String, Object> map = new HashMap<>();
                map.put(MANOR_BUILDNAME, buildingData.getId());
                map.put("manor_buildid", buildingData.getSkinId());
                UserSkin userSkin = skinModule.getUserSkin(buildingData.getSkinId());
                if(userSkin != null) {
                    map.put(MANOR_BUILDLV, userSkin.getLevel());
                }
                objectGroup.add(map);
            }
            action.build(MANOR_BUILD, objectGroup);

            action.trace();
        } catch (Exception e) {
            DataAnalyticsMgr.getLogger().error(" error ", e);
        }

    }


    /**
     * 鱼塘快照
     */
     public static void uploadBaseInfoSnapshot(GamePlayer player){

         try {
             if (!DataAnalyticsMgr.openDataAnalytics()) return;

             ManorModule manorModule = player.getModule(ManorModule.class);

             DefaultEventTraceAction action = new DefaultEventTraceAction(FISH_POND, player);
             //图鉴成就
             int count = 0;
             Map<Integer, FishPondItemConfig> itemConfigMap = FishPondMgr.getFishPondItemConfigMap();
             for (Map.Entry<Integer, FishData> dataEntry : manorModule.getManorFishPondModel().getFishDataMap().entrySet()) {
                 if(itemConfigMap.containsKey(dataEntry.getKey())){
                     count++;
                 }
             }
             action.build("FISH_ALL", itemConfigMap.size());
             action.build("FISH_ACCLV", count);

             //勋章
             action.build(FISH_LEVEL, manorModule.getManorFishPondModel().getFishPondData().getFishPondLv() % 1000);

             action.trace();
         }catch (Exception e) {
             DataAnalyticsMgr.getLogger().error(" error ", e);
         }
     }
}
